package demo

import (
	"app/internal/cache/base"
	"app/wd"
	"context"
	"fmt"

	"github.com/spf13/cobra"
)

// Demo  demo command
func (c Command) Demo(ctx context.Context) *cobra.Command {
	var demoCmd = &cobra.Command{
		Use: "demo",
		Run: func(cmd *cobra.Command, args []string) {
			//var res map[string]interface{}
			//err := demo.Cache{}.Get(ctx, "demo", &res)
			//res, err := demo.Cache{}.GetString(ctx, "demo")
			//res, err := base.NewCache().GetString(ctx, "key1")
			res, no, err := base.NewCache().GetMGetString(ctx, "key", []string{"1", "2", "6", "3", "4", "5"})
			fmt.Println("res:", res)
			fmt.Println("no:", no)
			fmt.Printf("err:%+v", err)
		},
	}
	return demoCmd
}

// Demo2 demo command
func (c Command) Demo2(ctx context.Context) *cobra.Command {
	var demoCmd = &cobra.Command{
		Use: "demo2",
		Run: func(cmd *cobra.Command, args []string) {
			fmt.Println("demo2")
			wd.App.SysLog.WithContext(ctx).Info("demo2")
		},
	}
	return demoCmd
}
